<template>

  <div class="clock">{{ date }}</div>

</template>

<script>
  import dateFormat from 'dateformat'

  export default {
    props: {
      format: {
        type: String,
        default: 'yyyy-mm-dd HH:MM:ss'
      }
    },
    data () {
      return {
        date: dateFormat(new Date(), this.format)
      }
    },
    mounted () {
      setInterval(() => { this.date = dateFormat(new Date(), this.format) }, 1000)
    }
  }
</script>
